package com.puti.doctor.controller;

import com.github.pagehelper.PageInfo;
import com.puti.common.core.web.controller.BaseController;
import com.puti.common.core.web.domain.AjaxResult;
import com.puti.common.core.web.page.TableDataInfo;
import com.puti.doctor.domian.DoctorPatientRecord;
import com.puti.doctor.domian.PatientHealth;
import com.puti.doctor.domian.PatientInfo;
import com.puti.doctor.service.PatientInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@CrossOrigin
@RestController
@RequestMapping("/patient")
public class PatientInfoController extends BaseController {

    @Autowired
    private PatientInfoService patientInfoService;

    //查询患者-个人信息 患者-个人信息列表
    @GetMapping("/selectPatientInfoList")
    public TableDataInfo selectPatientInfoList(PatientInfo patientInfo){
        startPage();
        List<PatientInfo> patientInfos = patientInfoService.selectPatientInfoList(patientInfo);
        return getDataTable(patientInfos);
    }

    //患者管理-患者就诊纪录列表selectDoctorPatientRecordList
    @GetMapping("/selectDoctorPatientRecordList")
    public TableDataInfo selectDoctorPatientRecordList(DoctorPatientRecord doctorPatientRecord){
        startPage();
        List<DoctorPatientRecord> doctorPatientRecords = patientInfoService.selectDoctorPatientRecordList(doctorPatientRecord);
        return getDataTable(doctorPatientRecords);
    }

    //患者诊断报告根据healthPatientId回显findPatientHealthByHealthId
    @GetMapping("/toUpdatePatientHealthList")
    public AjaxResult toUpdatePatientHealthList(Long healthPatientId){
        PatientHealth patientHealthByHealthId = patientInfoService.findPatientHealthByHealthId(healthPatientId);
        return AjaxResult.success(patientInfoService.findPatientHealthByHealthId(healthPatientId));
    }





}
